package dome1;

import java.util.Scanner;

//自定义异常
public class Login {
    public String userName = "yeye";
    public String passWord = "123456";

    public void Login(String userName, String passWord) throws UserNameErrorException,PassWordErrorException{
        if(!this.userName.equals(userName)){
          throw new UserNameErrorException("用户名错误，发生异常...");
       }

        if (!this.passWord.equals(passWord)){
            throw new PassWordErrorException("密码错误，发生异常...");
       }
        System.out.println("登入成功...");
   }

    public static void main1(String[] args) {
        Login login = new Login();
        try {
            login.Login("yye","123456");
        }catch (UserNameErrorException e){
            e.printStackTrace();
        }catch (PassWordErrorException e){
            e.printStackTrace();
        }

        System.out.println("程序继续执行...");
    }
}
